package com.wdg.common.response;

import com.wdg.common.enums.ResponseEnum;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

@Data
@Builder
public class ResponseVO implements Serializable {

    private Integer code;

    private String msg;

    private Object data;

    public static ResponseVO success(String msg, Integer code, Object data) {
        return ResponseVO.builder()
                .msg(msg)
                .code(code)
                .data(data)
                .build();
    }

    public static ResponseVO success(String msg, Object data) {
        return success(msg, ResponseEnum.SUCCESS.getCode(), data);

    }

    public static ResponseVO success(Object data) {
        return success("请求成功", ResponseEnum.SUCCESS.getCode(), data);

    }

    public static ResponseVO fail(String msg) {
        return ResponseVO.builder()
                .code(ResponseEnum.FAIL.getCode())
                .msg(msg)
                .build();
    }

    public static ResponseVO fail(String msg, Integer code) {
        return ResponseVO.builder()
                .code(code)
                .msg(msg)
                .build();
    }

    /**
     * 基础builder
     *
     * @return
     */
//    private static ResultVOBuilder resultVOBuilder() {
//        return ResultVO.builder();
//    }
}
